package org.lambda.supplier;

import java.util.function.Supplier;

public class SupplierConstructor {

    private String f1;
    private String f2;

    public SupplierConstructor() {
        System.out.println("constructor starting");
    }

    public static void main(String[] args) {
        /* T：出参类型；没有入参 */
        Supplier<SupplierConstructor> supplier = SupplierConstructor::new;

        SupplierConstructor o1 = supplier.get();
        SupplierConstructor o2 = supplier.get();

        SupplierConstructor o3 = new SupplierConstructor();
        SupplierConstructor o4 = new SupplierConstructor();

        Supplier<SupplierConstructor> supplier1 = () -> {
            SupplierConstructor o = new SupplierConstructor();
            o.setF1("1111");
            o.setF2("2222");
            return o;
        };

        SupplierConstructor o5 = supplier.get();
        SupplierConstructor o6 = supplier.get();

    }

    public void setF1(String f1) {
        this.f1 = f1;
    }

    public void setF2(String f2) {
        this.f2 = f2;
    }

}
